package io.renren.modules.app.utils;

import com.jpay.weixin.api.WxPayApiConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class WxPayApiConfigUtil {

    private static String appId;


    private  static String mchId;


    private static String partnerKey;

    @Value("${wxpay.appid}")
    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Value("${wxpay.mchid}")
    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    @Value(("${wxpay.paterner.key}"))
    public void setPartnerKey(String partnerKey) {
        this.partnerKey = partnerKey;
    }

    public static WxPayApiConfig getWxPayApiConfig() {
        return WxPayApiConfig.New().setAppId(appId).setMchId(mchId).setPaternerKey(partnerKey).setPayModel(WxPayApiConfig.PayModel.BUSINESSMODEL);
    }
}
